/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sv.com.compassion.entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Ernesto
 */
@Entity
@Table(name = "cdi")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Cdi.findAll", query = "SELECT c FROM Cdi c"),
    @NamedQuery(name = "Cdi.findByIdCdi", query = "SELECT c FROM Cdi c WHERE c.idCdi = :idCdi"),
    @NamedQuery(name = "Cdi.findByNomCdi", query = "SELECT c FROM Cdi c WHERE c.nomCdi = :nomCdi"),
    @NamedQuery(name = "Cdi.findByDirCdi", query = "SELECT c FROM Cdi c WHERE c.dirCdi = :dirCdi"),
    @NamedQuery(name = "Cdi.findByTelCdi", query = "SELECT c FROM Cdi c WHERE c.telCdi = :telCdi"),
    @NamedQuery(name = "Cdi.findByFecIniCdi", query = "SELECT c FROM Cdi c WHERE c.fecIniCdi = :fecIniCdi"),
    @NamedQuery(name = "Cdi.findByFecCierreCdi", query = "SELECT c FROM Cdi c WHERE c.fecCierreCdi = :fecCierreCdi"),
    @NamedQuery(name = "Cdi.findByFecApertura", query = "SELECT c FROM Cdi c WHERE c.fecApertura = :fecApertura"),
    @NamedQuery(name = "Cdi.findByEstCdi", query = "SELECT c FROM Cdi c WHERE c.estCdi = :estCdi"),
    @NamedQuery(name = "Cdi.findByAuAddUsr", query = "SELECT c FROM Cdi c WHERE c.auAddUsr = :auAddUsr"),
    @NamedQuery(name = "Cdi.findByAuAddDat", query = "SELECT c FROM Cdi c WHERE c.auAddDat = :auAddDat"),
    @NamedQuery(name = "Cdi.findByAuModUsr", query = "SELECT c FROM Cdi c WHERE c.auModUsr = :auModUsr"),
    @NamedQuery(name = "Cdi.findByAuModDat", query = "SELECT c FROM Cdi c WHERE c.auModDat = :auModDat"),
    @NamedQuery(name = "Cdi.findByDesCdi", query = "SELECT c FROM Cdi c WHERE c.desCdi = :desCdi")})
public class Cdi implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idCdi")
    private Integer idCdi;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "nomCdi")
    private String nomCdi;
    @Size(max = 100)
    @Column(name = "dirCdi")
    private String dirCdi;
    @Size(max = 9)
    @Column(name = "telCdi")
    private String telCdi;
    @Basic(optional = false)
    @NotNull
    @Column(name = "fecIniCdi")
    @Temporal(TemporalType.DATE)
    private Date fecIniCdi;
    @Column(name = "fecCierreCdi")
    @Temporal(TemporalType.DATE)
    private Date fecCierreCdi;
    @Column(name = "fecApertura")
    @Temporal(TemporalType.DATE)
    private Date fecApertura;
    @Basic(optional = false)
    @NotNull
    @Column(name = "estCdi")
    private int estCdi;
    @Basic(optional = false)
    @NotNull
    @Column(name = "AuAddUsr")
    private int auAddUsr;
    @Basic(optional = false)
    @NotNull
    @Column(name = "AuAddDat")
    @Temporal(TemporalType.DATE)
    private Date auAddDat;
    @Column(name = "AuModUsr")
    private Integer auModUsr;
    @Column(name = "AuModDat")
    @Temporal(TemporalType.DATE)
    private Date auModDat;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "desCdi")
    private String desCdi;
    @JoinColumn(name = "idMunicipio", referencedColumnName = "idMunicipio")
    @ManyToOne(optional = false)
    private Municipio idMunicipio;

    public Cdi() {
    }

    public Cdi(Integer idCdi) {
        this.idCdi = idCdi;
    }

    public Cdi(Integer idCdi, String nomCdi, Date fecIniCdi, int estCdi, int auAddUsr, Date auAddDat, String desCdi) {
        this.idCdi = idCdi;
        this.nomCdi = nomCdi;
        this.fecIniCdi = fecIniCdi;
        this.estCdi = estCdi;
        this.auAddUsr = auAddUsr;
        this.auAddDat = auAddDat;
        this.desCdi = desCdi;
    }

    public Integer getIdCdi() {
        return idCdi;
    }

    public void setIdCdi(Integer idCdi) {
        this.idCdi = idCdi;
    }

    public String getNomCdi() {
        return nomCdi;
    }

    public void setNomCdi(String nomCdi) {
        this.nomCdi = nomCdi;
    }

    public String getDirCdi() {
        return dirCdi;
    }

    public void setDirCdi(String dirCdi) {
        this.dirCdi = dirCdi;
    }

    public String getTelCdi() {
        return telCdi;
    }

    public void setTelCdi(String telCdi) {
        this.telCdi = telCdi;
    }

    public Date getFecIniCdi() {
        return fecIniCdi;
    }

    public void setFecIniCdi(Date fecIniCdi) {
        this.fecIniCdi = fecIniCdi;
    }

    public Date getFecCierreCdi() {
        return fecCierreCdi;
    }

    public void setFecCierreCdi(Date fecCierreCdi) {
        this.fecCierreCdi = fecCierreCdi;
    }

    public Date getFecApertura() {
        return fecApertura;
    }

    public void setFecApertura(Date fecApertura) {
        this.fecApertura = fecApertura;
    }

    public int getEstCdi() {
        return estCdi;
    }

    public void setEstCdi(int estCdi) {
        this.estCdi = estCdi;
    }

    public int getAuAddUsr() {
        return auAddUsr;
    }

    public void setAuAddUsr(int auAddUsr) {
        this.auAddUsr = auAddUsr;
    }

    public Date getAuAddDat() {
        return auAddDat;
    }

    public void setAuAddDat(Date auAddDat) {
        this.auAddDat = auAddDat;
    }

    public Integer getAuModUsr() {
        return auModUsr;
    }

    public void setAuModUsr(Integer auModUsr) {
        this.auModUsr = auModUsr;
    }

    public Date getAuModDat() {
        return auModDat;
    }

    public void setAuModDat(Date auModDat) {
        this.auModDat = auModDat;
    }

    public String getDesCdi() {
        return desCdi;
    }

    public void setDesCdi(String desCdi) {
        this.desCdi = desCdi;
    }

    public Municipio getIdMunicipio() {
        return idMunicipio;
    }

    public void setIdMunicipio(Municipio idMunicipio) {
        this.idMunicipio = idMunicipio;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCdi != null ? idCdi.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cdi)) {
            return false;
        }
        Cdi other = (Cdi) object;
        if ((this.idCdi == null && other.idCdi != null) || (this.idCdi != null && !this.idCdi.equals(other.idCdi))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sv.com.compassion.entidades.Cdi[ idCdi=" + idCdi + " ]";
    }
    
}
